<?php

	error_reporting(0);
	session_start();
	error_reporting(1);
	
	$id = $_GET['id'];
	$mode = $_GET['mode'];
	$tofrom = ($mode == "inbox") ? "to" : "from";

	require_once "../common/PinSQL.obj";
	$pinSQL = new PinSQL();
	
	$username = $_SESSION['username'];
	
	$pinSQL->Query("UPDATE messages SET archived='1' WHERE id='$id' AND " . $tofrom . "user='$username'");

 	header ("Location: frame.php?page=$mode");

?>